package com.lecyon.farm.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lecyon.farm.base.BaseRequestPageVo;
import com.lecyon.farm.base.RestResponse;
import com.lecyon.farm.service.IFmWorkService;
import com.lecyon.farm.vo.query.QueryFmWorkVo;
import com.lecyon.farm.vo.view.FmWorkVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 农机作业历史表 Controller
 *
 * @author YaoZheng
 * @since 2020-04-02
 */
@RestController
@RequestMapping("/fm-work")
@Api(tags = "农机作业")
@ResponseBody
@CrossOrigin
public class FmWorkController {

    private IFmWorkService fmWorkService;

    @Autowired
    public FmWorkController(IFmWorkService fmWorkService) {
        this.fmWorkService = fmWorkService;
    }

    @ApiOperation(value = "查询作业列表", notes = "查询作业列表(分页)，author:YaoZheng")
    @PostMapping(value = "/getList")
    public RestResponse<Page<FmWorkVo>> getPageList(@RequestBody @Valid BaseRequestPageVo<QueryFmWorkVo> vo) {
        return fmWorkService.getPageList(vo);
    }

    @ApiOperation(value = "查询日报列表", notes = "查询日报列表(分页)，author:YaoZheng")
    @PostMapping(value = "/dailyData/getList")
    public RestResponse<Page<FmWorkVo>> dailyDataList(@RequestBody @Valid BaseRequestPageVo<QueryFmWorkVo> vo) {
        return fmWorkService.dailyDataList(vo);
    }

}
